﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RptThongKeNhanSu.aspx.cs"
    Inherits="Viewer.NhanSu.Reporting.RptThongKeNhanSu" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src="~/NhanSu/UserControl/UcToChuc.ascx" TagName="UcToChuc" TagPrefix="uc" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/UserControls/UCReporting.ascx" TagName="UCReporting" TagPrefix="uc" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <ext:XScript ID="XScipt1" runat="server">
     <script type="text/javascript">
           function InsertToChuc(number,name)
            {           
                if(#{hdReportType}.getValue() == '5')
                {
                  #{txtToChuc_ThayDoi}.setValue(name);   
                }
                else
                {                    
                    #{txtToChuc}.setValue(name);          
                }
                #{hdTochucID}.setValue(number);
            }
           var filterTree = function(el, e) {
            var tree = TreePanel,
                text = this.getRawValue();

            tree.clearFilter();

            if (Ext.isEmpty(text, false)) {
                return;
            }

            if (e.getKey() === Ext.EventObject.ESC) {
                clearFilter();
            } else {
                var re = new RegExp(".*" + text + ".*", "i");

                tree.filterBy(function(node) {
                    return re.test(node.text);
                });
            }
        };
        var clearFilter = function() {
            var field = TriggerField1,
                tree = TreePanel;

            field.setValue("");
            tree.clearFilter();
            tree.getRootNode().collapseChildNodes(true);
            tree.getRootNode().ensureVisible();
        };

        var refreshTree = function(tree, result) {
            var nodes = eval(result);
            if (nodes.length > 0) {
                tree.initChildren(nodes);
            }
            else {
                tree.getRootNode().removeChildren();
            }
        }
        
          var TreePanel_Click= function(node)
        {
          Ext.net.Mask.show();    
            if(!node.attributes.IsAdd == '0')
            {   
                btnAddNew.enable();
            }
            else 
            {
                btnAddNew.disable();
                
            }
              X.LoadGrid(node.id,node.text);  
            if(__currentNode.getValue() == node.id)return ;
                __currentNode.setValue(node.id);
              
              
            
            IsView= node.attributes.IsView == '1'? true : false;
            IsEdit= node.attributes.IsEdit == '1'? true : false;
            IsDelete= node.attributes.IsDelete == '1'? true : false;
                
        };
        
        var IsView,IsEdit,IsDelete;
        
        var storeNhanVien_RemoveById= function(id)
        {
            var record = storeNhanVien.getById(id);
            storeNhanVien.remove(record);
        }
        
        var prepareCommand = function (grid, toolbar, rowIndex, record) {
            var firstGrid = toolbar.items.get(0);
            firstGrid.menu.items.items[0].disabled=!IsView;
            firstGrid.menu.items.items[1].disabled=!IsEdit;
            firstGrid.menu.items.items[2].disabled=!IsDelete;
            
             //   firstButton.setDisabled(true);
            
            //you can return false to cancel toolbar for this record
        };  
            var ShowTip = function(toolTip,text) {  
             
            if(text!='')
            {
                toolTip.body.dom.innerHTML =text  ;
            }
           
 
        };             
        </script>
    </ext:XScript>
</head>
<body style="background-color: White; width: 100%; height: 100%">
    <form id="form1" runat="server">
    <ext:ResourceManager Locale="vi" ID="ResourceManager1" runat="server">
    </ext:ResourceManager>
    </asp:UpdateProgress>
    <ext:Hidden ID="hdTochucID" runat="server">
    </ext:Hidden>
    <ext:Viewport ID="Viewport1" runat="server">
        <Items>
            <ext:BorderLayout ID="BorderLayout1" runat="server">
                <Center>
                    <ext:Panel runat="server" ID="PnlCenter" StyleSpec="margin:5px;" Width="500" Border="false">
                        <Bin>
                            <ext:Store runat="server" ID="storeNam">
                                <Reader>
                                    <ext:JsonReader>
                                        <Fields>
                                            <ext:RecordField Name="Text" />
                                            <ext:RecordField Name="Value" />
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
                        </Bin>
                        <Items>
                            <ext:Panel runat="server" ID="PnlSearch" Width="650" StyleSpec="padding:5px" Hidden="true"
                                Border="true">
                                <Items>
                                    <ext:BoxComponent ID="BoxComponent1" runat="server" Height="5px" />
                                    <ext:CompositeField ID="CompositeField1" runat="server" StyleSpec="padding-left:3px;">
                                        <Items>
                                            <ext:Label ID="label1" runat="server" Text="<%$ Resources:Resource, ToChuc %>" Width="100" />
                                            <ext:TextField ID="txtToChuc" runat="server" ReadOnly="true" Width="200">
                                                <ToolTips>
                                                    <ext:ToolTip ID="ToolTip3" runat="server" AutoHide="true" TrackMouse="true">
                                                        <Listeners>
                                                            <Show Handler="ShowTip(this,#{txtToChuc}.getValue())" />
                                                        </Listeners>
                                                    </ext:ToolTip>
                                                </ToolTips>
                                            </ext:TextField>
                                            <ext:Button ID="btnAddNewNhomQuyenByModule" runat="server" Text="Chọn tổ chức"
                                                Icon="Magnifier">
                                                <Listeners>
                                                    <Click Handler="#{DirectMethods}.ShowPopUp()" />
                                                </Listeners>
                                            </ext:Button>
                                            <ext:Label ID="lblMessageToChuc_NhanVien" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                Hidden="true" Text="Xin vui lòng chọn tổ chức" />
                                        </Items>
                                    </ext:CompositeField>
                                    <ext:BoxComponent ID="BoxComponent2" runat="server" Height="3" />
                                    <ext:CompositeField ID="CompositeField7" runat="server" StyleSpec="padding-left:3px;">
                                        <Items>
                                            <ext:Label ID="label6" runat="server" Text="Năm" Width="100" />
                                            <ext:ComboBox ID="cbbYear" runat="server" Width="100" EmptyText="Chọn" StoreID="storeNam"
                                                ValueField="Value" DisplayField="Text" />
                                            <ext:Label ID="lblMessageYear_NhanVien" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                Hidden="true" Text="Xin vui lòng chọn năm" />
                                        </Items>
                                    </ext:CompositeField>
                                    <ext:BoxComponent ID="BoxComponent3" runat="server" Height="5px" />
                                    <ext:CompositeField runat="server" StyleSpec="padding-left:150px;">
                                        <Items>
                                            <ext:Button ID="Button4" runat="server" Text="Xoá điều kiện" IconAlign="Right"
                                                Icon="PageWhite">
                                                <Listeners>
                                                    <Click Handler="#{DirectMethods}.btnReset_Click();" />
                                                </Listeners>
                                            </ext:Button>
                                            <ext:Button ID="Button5" runat="server" Text="Xem báo cáo" Icon="Zoom" IconAlign="Right">
                                                <Listeners>
                                                    <Click Handler="#{DirectMethods}.btnGenerate_Click();" />
                                                </Listeners>
                                            </ext:Button>
                                        </Items>
                                    </ext:CompositeField>
                                    <ext:BoxComponent ID="BoxComponent10" runat="server" Height="5px" />
                                </Items>
                            </ext:Panel>
                            <ext:Panel runat="server" ID="PnlSearchThayDoiNhanVien" StyleSpec="padding:5px;"
                                Width="700" Hidden="true" Border="true">
                                <Bin>
                                    <ext:Store runat="server" ID="storeQui">
                                        <Reader>
                                            <ext:JsonReader>
                                                <Fields>
                                                    <ext:RecordField Name="Text" />
                                                    <ext:RecordField Name="Value" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                    <ext:Store runat="server" ID="storeThang">
                                        <Reader>
                                            <ext:JsonReader>
                                                <Fields>
                                                    <ext:RecordField Name="Text" />
                                                    <ext:RecordField Name="Value" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                    <ext:Store runat="server" ID="store1">
                                        <Reader>
                                            <ext:JsonReader>
                                                <Fields>
                                                    <ext:RecordField Name="Text" />
                                                    <ext:RecordField Name="Value" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                </Bin>
                                <Items>
                                    <ext:BoxComponent ID="BoxComponent9" runat="server" Height="5px" />
                                    <ext:CompositeField ID="CompositeField2" runat="server" StyleSpec="padding-left:3px;">
                                        <Items>
                                            <ext:Label ID="label2" runat="server" Text="<%$ Resources:Resource, ToChuc %>" Width="100" />
                                            <ext:TextField ID="txtToChuc_ThayDoi" runat="server" ReadOnly="true" Width="204">
                                                <ToolTips>
                                                    <ext:ToolTip ID="ToolTip1" runat="server" AutoHide="true" TrackMouse="true">
                                                        <Listeners>
                                                            <Show Handler="ShowTip(this,#{txtToChuc_ThayDoi}.getValue())" />
                                                        </Listeners>
                                                    </ext:ToolTip>
                                                </ToolTips>
                                            </ext:TextField>
                                            <ext:Button ID="Button1" runat="server" Text="Chọn tổ chức" Icon="Magnifier">
                                                <Listeners>
                                                    <Click Handler="#{DirectMethods}.ShowPopUp()" />
                                                </Listeners>
                                            </ext:Button>
                                        </Items>
                                    </ext:CompositeField>
                                    <ext:BoxComponent ID="BoxComponent4" runat="server" Height="3" />
                                    <ext:CompositeField ID="CompositeField3" runat="server" StyleSpec="padding-left:3px;">
                                        <Items>
                                            <ext:Label ID="label3" runat="server" Text="Hiển thị theo" Width="100" />
                                            <ext:ComboBox ID="ccbLoai" runat="server" Width="204" EmptyText="Chọn" AutoPostBackEvent="Select">
                                                <Items>
                                                    <ext:ListItem Text="Quí" Value="Qui" />
                                                    <ext:ListItem Text="Tháng" Value="Month" />
                                                    <ext:ListItem Text="Năm" Value="Year" />
                                                </Items>
                                                <Listeners>
                                                    <Select Handler="#{DirectMethods}.Disable()" />
                                                </Listeners>
                                            </ext:ComboBox>
                                            <ext:Label ID="lblMessage" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                Hidden="true" Text="Xin vui lòng chọn loại báo cáo" />
                                        </Items>
                                    </ext:CompositeField>
                                    <ext:BoxComponent ID="BoxComponent5" runat="server" Height="3" />
                                    <ext:Panel ID="PnlThang" runat="server" Hidden="true" Border="false" StyleSpec="padding-left:3px;">
                                        <Items>
                                            <ext:CompositeField ID="CompositeField4" runat="server">
                                                <Items>
                                                    <ext:Label ID="label4" runat="server" Text="Từ" Width="100" />
                                                    <ext:ComboBox ID="cbbFromMonth" runat="server" Width="100" EmptyText="Chọn" StoreID="storeThang"
                                                        ValueField="Value" DisplayField="Text">
                                                    </ext:ComboBox>
                                                    <ext:ComboBox ID="cbbFromYear" runat="server" Width="100" EmptyText="Chọn" StoreID="storeNam"
                                                        ValueField="Value" DisplayField="Text" />
                                                    <ext:Label ID="lblMessageFrom_Thang" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                        Hidden="true" Text="Xin vui lòng chọn tháng và năm" />
                                                </Items>
                                            </ext:CompositeField>
                                            <ext:BoxComponent ID="BoxComponent6" runat="server" Height="3" />
                                            <ext:CompositeField ID="CompositeField5" runat="server">
                                                <Items>
                                                    <ext:Label ID="label5" runat="server" Text="Đến" Width="100" />
                                                    <ext:ComboBox ID="cbbEndMonth" runat="server" Width="100" EmptyText="Chọn" StoreID="storeThang"
                                                        ValueField="Value" DisplayField="Text">
                                                    </ext:ComboBox>
                                                    <ext:ComboBox ID="cbbEndYear" runat="server" Width="100" EmptyText="Chọn" StoreID="storeNam"
                                                        ValueField="Value" DisplayField="Text" />
                                                    <ext:Label ID="lblMessageEnd_Thang" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                        Hidden="true" Text="Xin vui lòng chọn tháng và năm" />
                                                </Items>
                                            </ext:CompositeField>
                                        </Items>
                                    </ext:Panel>
                                    <ext:Panel ID="pnlQui" runat="server" Hidden="true" Border="false" StyleSpec="padding-left:3px;">
                                        <Items>
                                            <ext:CompositeField ID="CompositeField6" runat="server">
                                                <Items>
                                                    <ext:Label ID="label7" runat="server" Text="Từ" Width="100" />
                                                    <ext:ComboBox ID="cbbFrom_Qui" runat="server" Width="100" EmptyText="Chọn" DisplayField="Text"
                                                        StoreID="storeQui" ValueField="Value">
                                                    </ext:ComboBox>
                                                    <ext:ComboBox ID="cbbFromYear_Qui" runat="server" Width="100" EmptyText="Chọn" StoreID="storeNam"
                                                        DisplayField="Text" ValueField="Value" />
                                                    <ext:Label ID="lblMesseageForm_Qui" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                        Hidden="true" Text="Xin vui lòng chọn quí và năm" />
                                                </Items>
                                            </ext:CompositeField>
                                            <ext:BoxComponent ID="BoxComponent7" runat="server" Height="3" />
                                            <ext:CompositeField ID="CompositeField8" runat="server">
                                                <Items>
                                                    <ext:Label ID="label8" runat="server" Text="Đến" Width="100" />
                                                    <ext:ComboBox ID="cbbEnd_Qui" runat="server" Width="100" EmptyText="Chọn" DisplayField="Text"
                                                        StoreID="storeQui" ValueField="Value">
                                                    </ext:ComboBox>
                                                    <ext:ComboBox ID="cbbEndYear_Qui" runat="server" Width="100" EmptyText="Chọn" StoreID="storeNam"
                                                        DisplayField="Text" ValueField="Value" />
                                                    <ext:Label ID="lblMessageEnd_Qui" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                        Hidden="true" Text="Xin vui lòng chọn quí và năm" />
                                                </Items>
                                            </ext:CompositeField>
                                        </Items>
                                    </ext:Panel>
                                    <ext:Panel ID="pnlYear" runat="server" Hidden="true" Border="false" StyleSpec="padding-left:3px;">
                                        <Items>
                                            <ext:CompositeField ID="CompositeField9" runat="server">
                                                <Items>
                                                    <ext:Label ID="label9" runat="server" Text="Từ" Width="100" />
                                                    <ext:ComboBox ID="cbbFrom_Year" runat="server" Width="100" EmptyText="Chọn" StoreID="storeNam"
                                                        ValueField="Value" DisplayField="Text" />
                                                    <ext:Label ID="lblMessageFromYear_Year" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                        Hidden="true" Text="Xin vui lòng chọn năm" />
                                                </Items>
                                            </ext:CompositeField>
                                            <ext:BoxComponent ID="BoxComponent8" runat="server" Height="3" />
                                            <ext:CompositeField ID="CompositeField10" runat="server">
                                                <Items>
                                                    <ext:Label ID="label11" runat="server" Text="Đến" Width="100" />
                                                    <ext:ComboBox ID="cbbEnd_Year" runat="server" Width="100" EmptyText="Chọn" StoreID="storeNam"
                                                        ValueField="Value" DisplayField="Text" />
                                                    <ext:Label ID="lblMessageEndYear_Year" runat="server" StyleSpec="color:red;padding-top:3px;"
                                                        Hidden="true" Text="Xin vui lòng chọn năm" />
                                                </Items>
                                            </ext:CompositeField>
                                        </Items>
                                    </ext:Panel>
                                    <ext:BoxComponent ID="BoxComponent11" runat="server" Height="5px" />
                                    <ext:CompositeField ID="CompositeField11" runat="server" StyleSpec="padding-left:120px;">
                                        <Items>
                                            <ext:Button ID="Button2" runat="server" Text="Xoá điều kiện" IconAlign="Right"
                                                Icon="PageWhite">
                                                <Listeners>
                                                    <Click Handler="#{DirectMethods}.btnReset_Click();" />
                                                </Listeners>
                                            </ext:Button>
                                            <ext:Button ID="Button3" runat="server" Text="Xem báo cáo" Icon="Zoom" IconAlign="Right">
                                                <Listeners>
                                                    <Click Handler="#{DirectMethods}.btnGenerate_Click();" />
                                                </Listeners>
                                            </ext:Button>
                                        </Items>
                                    </ext:CompositeField>
                                    <ext:BoxComponent ID="BoxComponent12" runat="server" Height="3" />
                                </Items>
                            </ext:Panel>
                        </Items>
                    </ext:Panel>
                </Center>
                <East>
                    <ext:Panel ID="Panel" runat="server" Collapsible="true" Title="Báo cáo" Width="250">
                        <Items>
                            <ext:MenuPanel ID="MenuPanel1" runat="server">
                                <Menu ID="Menu3" runat="server">
                                    <Items>
                                        <ext:Hidden ID="hdReportType" runat="server" />
                                        <ext:MenuItem ID="MenuItem7" runat="server" Text="Danh Sách Nhân Viên" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(false,true);#{hdReportType}.setValue('6');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuItem ID="MenuItem12" runat="server" Text="Tỉ Lệ Nam Nữ" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(false,true);#{hdReportType}.setValue('7');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuItem ID="MenuItem1" runat="server" Text="Nghỉ Phép" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(false,true);#{hdReportType}.setValue('0');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuItem ID="MenuItem3" runat="server" Text="Hợp Đồng" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(false,true);#{hdReportType}.setValue('1');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuItem ID="MenuItem4" runat="server" Text="Bậc Lương" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(false,true);#{hdReportType}.setValue('2');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuItem ID="MenuItem2" runat="server" Text="Phụ Cấp Chức Vụ" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(false,true);#{hdReportType}.setValue('3');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuItem ID="MenuItem5" runat="server" Text="Phụ Cấp Khác" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(false,true);#{hdReportType}.setValue('4');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuItem ID="MenuItem6" runat="server" Text="Mức Độ Thay Đổi Nhân Viên" Icon="Report">
                                            <Listeners>
                                                <Click Handler="#{DirectMethods}.SetHidden(true,false);#{hdReportType}.setValue('5');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </Menu>
                            </ext:MenuPanel>
                        </Items>
                    </ext:Panel>
                </East>
            </ext:BorderLayout>
        </Items>
    </ext:Viewport>
    </form>
    <uc:UCReporting ID="UCReporting" runat="server" />
    <uc:UcToChuc ID="UcToChuc" runat="server" />
</body>
</html>
